use rpassword::read_password;

/// Menu
/// 
/// This is an account tool
/// 
/// It can receive user's input and return its md5.
pub fn input_password() -> String {
    let password_srt:String;
    
    // Input password
    loop {
        println!("Enter your password:");
        // 读取密码（输入时不显示）
        let password = read_password();

        password_srt = match password {
            Ok(password) => {
                password
            },
            Err(_) => {
                println!("Input error.");
                continue;
            }
        };
        break;
    }

    // Password to md5
    format!("{:x}", md5::compute(password_srt))
}